package auctions;

public class DutchSimpleBuyer implements DutchBuyerStrategy {
    private static final double upLimit = 0.8;
    
    public boolean checkOffer(int itemsTotal, int itemsToBuy, int price,
                              int budget) {
        if((0 == budget) || (0 == itemsToBuy)) {
            return false;
        } else {
            return true;
        }
    }

    public int itemsToBuy(int itemsTotal, int itemsToBuy, int price,
                          int budget) {
        if(price * itemsToBuy <= budget) {
            return itemsToBuy;
        } else if(price * itemsToBuy < budget * upLimit) {
            return 1;
        } else  if (itemsTotal < itemsToBuy) {
            return budget / price;
        } else {
            return 0;
        }
    }
}
